<html>
<head>
<script>
	var isOn = {};
	chrome.browserAction.onClicked.addListener(function(tab) {
		var error = null,id = tab.id;
		if(tab.url.indexOf("https://chrome.google.com") == 0 || tab.url.indexOf("chrome://") == 0 || tab.url.indexOf("googleusercontent.com") == 0){
        	error = chrome.i18n.getMessage("error_google");
		}else if(tab.url.indexOf("file:///") == 0){
			error = chrome.i18n.getMessage("error_local");
		}
		if(error){
			alert(error);
			return;
		}
		chrome.tabs.executeScript(id, {file: "vf.js"},function(){
			chrome.tabs.insertCSS(id, {file: "vf.css"});
		});
		if(!isOn[id]){
			chrome.browserAction.setTitle({"tabId":id,"title":"visual firebug(on)"});
			chrome.browserAction.setIcon({"tabId":id,"path":"vf-on.png"});
			isOn[id] = true;
		}else{
			chrome.browserAction.setTitle({"tabId":id,"title":"visual firebug(off)"});
			chrome.browserAction.setIcon({"tabId":id,"path":"vf-off.png"});
			isOn[id] = false;
		}
});
</script>
</head>
</html>
